<template>
    <div class="parent">
        <child></child>
        <h1>{{str}}</h1>
        <h1>我是parent页面</h1>
         <h3>{{_this.age}}</h3>
         <h3>{{_this.name}}</h3>
          <h1>{{_this.message}}</h1>
         <h1>{{message}}</h1>
    </div>
</template>
<script>
import child from '../components/child' //child 和parent页面又是父子关系
export default {
    data() {
        return {
            str:'',
            msg:'hello 我是parent的数据'
        }
    },
    // inject:['age','name']
    inject:['_this','fn','message'],
    created() {
        this.fn()
     

        console.log(this.$parent.yyds);
        console.log(this.$parent);
        this.str = this.$parent.yyds
    },
    mounted() {
        
    },
    methods: {
        parentFn(){
            console.log('我是parent里面的方法');
        }
    },
    components:{
        child
    }
}
</script>
